﻿namespace CodeGenerator.CSharp
{
    public class Constant : CodeUnit
    {

        public Constant(string name, ModifierCollection modifiers, string dataType, string value)
            : base(name, modifiers)
        {
            this.DataType = dataType;
            this.Value = value;
        }

        /// <summary>
        /// Identifies the value of the constant.
        /// </summary>
        public string Value { get; set; }

        public override string ToString()
        {
            CodeBuilder Code = new CodeBuilder();

            this.AppendDocumentation(Code);
            this.AppendAttributes(Code);

            Code.Add("{0}{1} const {2} {3} = {4};", this.Padding, this.Modifiers, this.DataType, this.Name, this.Value);

            return Code.ToString();
        }

    }
}
